var pageii = null;
var grid = null;
$(function() {
	grid = lyGrid({
		pagId : 'paging',
		l_column : [ {
			colkey : "tranDate",
			name : "送货日期",
			renderData : function(rowindex, data, rowdata, column) {
				return new Date(data).format("yyyy-MM-dd");
			}
		},{
			colkey : "outReceiptNo",
			name : "出仓单号"
		},{
			colkey : "permitNo",
			name : "放行条单号"
		},{
			colkey : "cid",
			name : "客户编号"
		},{
			colkey : "cname",
			name : "客户名称"
		},{
			colkey : "username",
			name : "仓管员"
		}, {
			colkey : "licenseNo",
			name : "车牌号"
		}, {
			colkey : "noReturnTime",
			name : "超期未回单时间",
			renderData : function(rowindex, data, rowdata, column) {
				if(data<=new Date()){
					return "<font color='red'>"+new Date(data).format("yyyy-MM-dd hh:mm:ss")+"</font>";
				}else{
					return new Date(data).format("yyyy-MM-dd hh:mm:ss");
				}
			}
		}, {
			colkey : "noReturnReason",
			name : "未回单原因"
		}, {
			colkey : "handleResult",
			name : "处理结果"
		} ],
		jsonUrl : rootPath + '/outreceipt_unback/outreceipt_unback_findByPage.shtml',
		dymCol : true,
		checkbox : true,
		serNumber : false
	});
	$("#editFun").click("click", function() {
		editAccount();
	});
	$("#search").click("click", function() {//  绑定查询按扭

		var searchParams = $("#searchForm").serializeJson();
		grid.setOptions({
			data : searchParams
		});
	});

});
function editAccount() {
	var cbox = grid.getSelectedCheckbox();
	 if (cbox.length > 1 || cbox == "") {
		 layer.msg("只能选中一个");
		 return;
	 }
	pageii = layer.open({
		title : "编辑未回单",
		type : 2,
		area : [ "800px", "100%" ],
		content : rootPath + '/outreceipt_unback/outreceipt_unback_edit.shtml?id='
				+ cbox
	});
}
